<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /**
         * 使用JSON对象，存储一个用户数据
         */
        var user = {
            "name": "tom",
            "age": 19,
            "sex": "男",
            "height": 189.4,
            "address": {
                "province": "江苏省",
                "city": "南京",
                "district": "玄武区",
                "street": "文德路"
            }
        }
        console.log(user)
        console.log(user.name, user.age)
        console.log(user.address.city)

        // 对象数组
        var users = [
            {
                "username": "tom",
                "password": "123456",
                "age": 18
            },
            {
                "username": "jerry",
                "password": "123",
                "age": 28
            },
            {
                "username": "lucy",
                "password": "111",
                "age": 19
            }
        ]

        for(var u of users){
            console.log(u.username, u.password, u.age)
        }
    </script>
</body>
</html>